#include "mainscene.h"
#include "ui_mainscene.h"
#include<QPainter>
#include"mypushbutton.h"
#include<QTimer>
MainScene::MainScene(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainScene)
{
    ui->setupUi(this);
    connect(ui->actionquit,&QAction::triggered,[=](){});
    this->close();
    setFixedSize(8*64,8*64);
    this->setWindowTitle("海绵宝宝");
    this->setWindowIcon(QIcon(":/new/prefix1/D:/QT_boxgame/002.jpg"));
    MyPushButton * starBtn = new MyPushButton(":/new/prefix1/D:/QT_boxgame/_20210418210550.png");
    starBtn->setParent(this);
    starBtn->move(this->width()*0.5-starBtn->width()*0.5,this->height()*0.5);
    gamel = new Widget;

    connect(starBtn,&MyPushButton::clicked,[=](){

        starBtn->Zoom1();
        starBtn->Zoom2();
        QTimer::singleShot(300,this,[=]()
        {
            this->hide();
            gamel->show();
        });

    }
    );




}

void MainScene::paintEvent(QPaintEvent *)
{
    QPainter painter(this);

    QPixmap pix;
    pix.load(":/new/prefix1/D:/QT_boxgame/63bfafcfcc0051dc1544ef49b37adf1.jpg");

    painter.drawPixmap(0,0,this->width(),this->height(),pix);



}



MainScene::~MainScene()
{
    delete ui;
}

